<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%-- <c:set var="ctx" value="http://192.168.28.11/static"/>  --%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>CNC数据采集和管理系统</title>
 	<script type="text/javascript" src="${ctx}/js/jquery.min.js"></script>
 	<script type="text/javascript" src="${ctx}/js/easyui/jquery.easyui.min.js"></script>
 	<link id="easyuiTheme" rel="stylesheet" type="text/css" href="${ctx}/css/easyui/themes/material/easyui.css">
 	<link rel="stylesheet" type="text/css" href="${ctx}/css/easyui/themes/icon.css">
 	<link rel="stylesheet" type="text/css" href="${ctx}/css/extEasyUIIcon.css">
 	<link href="${ctx}/css/login.css" rel="stylesheet" type="text/css">
	<script type="text/javascript">
		$(function() {
			//jumpOutTabs();	
			
			if(window != top){
				alert('登录超时, 请重新登录.'); 
				top.location.href = location.href;
			}
			
			// 当按下回车键时 登录
			$('#password').textbox('textbox').bind('keydown', function(e){
				if (e.keyCode == 13){
					login();
				}
			});
			
		});
		
		//当请求为非ajax请求超时时，跳出tabs  防止登录界面在 iframe里面
		function jumpOutTabs(){
			var top = getTopWinow();
			if(window != top){
				alert('登录超时, 请重新登录.'); 
				top.location.href = location.href;
			}
		}
		
		function getTopWinow(){ 
			var p = window; 
			while(p != p.parent){ 
				p = p.parent; 
			} 
			return p;
		}
		
		// 系统登录
		function login(){
			var userName=$("#userName").val();
			if(userName==""){
				$("#error").html("用户不能为空!");
				return;
			}
	    	var password=$("#password").val();
			if(password==""){
				$("#error").html("登录密码不能为空!");
				return;
			}
			$("#error").html("");
			$('#form').submit(); 
		}
		

	

	</script>
</head>

<body class="login">
	<form id="form" name="form" action="${pageContext.request.contextPath}/system/loginAuth" method="post">
	<div class="login_m">
		
  		<div class="login_logo"><img src="${ctx}/images/logo2.png" width="398" height="57"></div>
		<div class="easyui-panel" title="登录系统" data-options="iconCls:'icon-login2'" style="width:100%;max-width:400px;padding:30px 60px;">
			<div style="margin-bottom:10px">
				<input name="userName" id="userName" class="easyui-textbox" style="width:100%;height:40px;padding:12px" data-options="prompt:'输入用户名',iconCls:'icon-man',iconWidth:38">
			</div>
			<div style="margin-bottom:20px">
				<input name="password" id="password" class="easyui-passwordbox" style="width:100%;height:40px;padding:12px" data-options="prompt:'输入密码',iconCls:'icon-lock',iconWidth:38,showEye:false">
			</div>
			 <div style="margin-bottom:20px">
				<%--<input name="rememberMe" type="checkbox" checked="checked">
				<span>Remember me</span>--%>
				<span id="error" class="errorCls">${msg}</span>
			</div> 
			<div>
				<a href="#" onclick="login();" id="loginBtn" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" style="padding:5px 0px;width:100%;">
					<span style="font-size:14px;">登录</span>
				</a>
			</div>
		</div>
	</div><!--login_m end-->
	
	<br />
	<br />
	 </form>

</body>

</html>